package revise.Array;

import java.util.Scanner;

//                                     数组
public class Test {
    public static void main(String[] args) {
        //一、数组的创建
        //未初始化默认为初始化为0
        //1.
        int[] arr1 = new int[10];
        //2.
        int[] arr2 = {1, 2, 3, 4, 5};
        //3.
        int[] arr3 = new int[]{1, 2, 3, 4, 5};//等价于2
        //4.
        int arr4[] = {1, 2, 3};//不推荐
        //二、数组的大小可以是变量
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr5 = new int[n];
        //三、数组的访问
        int[] arr6 = new int[]{1, 2, 3, 4, 5};
        int i = 0;
        for (i = 0;i < arr6.length; i++){
            System.out.println(arr6[i]);
        }
    }
}
